<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        * {
            margin: 0;
            padding: 0;
        }

        html,
        body {
            width: 100%;
            height: 100%;
        }

        .container {
            width: 100%;
            height: 100%;
        }

        .light {
            background-color: #f3f3f3;
            color: #333;
        }

        .dark {
            background-color: #333;
            color: #f3f3f3;
        }
    </style>
</head>

<body>
    <div class="container light">
        这是一大段话<br>
        这是一大段话<br>
        这是一大段话<br>
        这是一大段话<br>
    </div>
</body>
<script>
    let elem = document.querySelector('div')
    console.log(elem.className)
    elem.onclick = function () {
        if (elem.className.indexOf('light') != -1) 
        {
            elem.className = 'container dark'
        }
        else 
        {
            elem.className = 'container light'
        }
    }

</script>

</html>